import { Controller, Get, Param } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { CommonService } from './common.service';

@ApiTags('common')
@Controller('api/common')
export class CommonController {
  constructor(private readonly commonService: CommonService) {}

  @Get('captcha/:id') //当请求该接口时，返回一张随机图片验证码
  @ApiOperation({ summary: '获取图片验证码' })
  async getCode(@Param() params: any) {
    const captcha = await this.commonService.getcaptcha({
      id: params.id,
    });
    return captcha;
  }
}
